-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for resource-id #21101
Add support for resource-id #21101
Conversation
Squashed commits: [f0f046f] Fixes #9777 Add support for resource-id Track react tag using android.view.View.tag. Allow developers to set resource id by setting component.testID This pull request fixes the following issue. #9777 First, you need to declare the resource id by creating /_your_android_studio_folder_/res/values/ids.xml ``` <?xml version="1.0" encoding="utf-8"?> <resources> <item type="id" name="my_test_id"/> </resources> ``` Second, set the testID of your component to a resource name. ``` <Button onPress={onButtonPress} title="Press Me" testID='test_id' /> ``` Third, run the app and observe the resource id using UIAutomator viewer (/Android/sdk/tools/bin/uiautomatorviewer) This PR doesn't require a documentation change. [ANDROID] [BUGFIX] [com/facebook/react/uimanager/BaseViewManager] - Allow developers to set resource id by setting component.testID [1ae19f5] Fixes #9777 Add support for resource-id Track react tag using android.view.View.tag. Allow developers to set resource id by setting component.testID This pull request fixes the following issue. #9777 First, you need to declare the resource id by creating /_your_android_studio_folder_/res/values/ids.xml ``` <?xml version="1.0" encoding="utf-8"?> <resources> <item type="id" name="my_test_id"/> </resources> ``` Second, set the testID of your component to a resource name. ``` <Button onPress={onButtonPress} title="Press Me" testID='test_id' /> ``` Third, run the app and observe the resource id using UIAutomator viewer (/Android/sdk/tools/bin/uiautomatorviewer) This PR doesn't require a documentation change. [ANDROID] [BUGFIX] [com/facebook/react/uimanager/BaseViewManager] - Allow developers to set resource id by setting component.testID
@lightboys22 This is great work! I would suggest renaming Perhaps a better name would be |
Is this a duplicate of #18527, which you also opened? |
@lightboys22 could you rebase this commit on master? Let's figure out how to get this merged! |
@cpojer Hi Christopher, Although Espresso only allows us to find UI elements by it content-description, Espresso is good enough for us. |
@cpojer We've recently run into this again for some of our projects. Are you still open to including this fix? |
@harking I am too lazy to continue to work on this pull request. My previous team was using Espresso, which allow you to find elements based on the “test-is” view tag. |
Track react tag using android.view.View.tag. Allow developers to set resource id by setting component.testID
Fixes #9777
Test Plan
First, you need to declare the resource id by creating /your_android_studio_folder/res/values/ids.xml
Second, set the testID of your component to a resource name.
Third, run the app and observe the resource id using UIAutomator viewer (/Android/sdk/tools/bin/uiautomatorviewer)
Changelog
[ANDROID] [Fixes] - BaseViewManager: Allow developers to set resource id by setting component.testID